package com.example.medicalretrieval.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;

import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;

import com.example.medicalretrieval.R;

import java.util.List;

public class ViewPagerAdapter extends PagerAdapter {
    private Context mContext;
    private List<Integer> mViewList;
    private View navBottom;
    public ViewPagerAdapter(Context context,List<Integer> viewList){
        this.mViewList = viewList;
        this.mContext = context;
    }
    @Override
    public int getCount() {
        return mViewList.size();
    }

    @Override
    public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
        return view==object;
    }

    @NonNull
    @Override
    public Object instantiateItem(@NonNull ViewGroup container, int position) {
        View inflate = View.inflate(mContext,mViewList.get(position),null);

        ImageButton navSearch = navBottom.findViewById(R.id.nav_search);
        ImageButton navHome = navBottom.findViewById(R.id.nav_home);
        switch (position){
            case 0:
                navHome.setOnClickListener(v -> {

                });
                break;
            case 1:
                break;
        }
        container.addView(inflate);
        return inflate;
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
        container.removeView((View) object);
    }


}
